<template>
  <div class="order-container">
    <ItemView v-for="(item,index) in orderList" :key="index" :data="item"/>
  </div>
</template>
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue"
import api from "../../api/index"
import ItemView from "./components/ItemView.vue"

interface IOrder {
  id: number,
  descs: string,
  image: string,
  num: string,
  ordernum: string,
  price: string,
  status: string,
  title: string,
  totalnum: string
}

const orderList = ref<IOrder>()

const props = defineProps<{
  type:string
}>()

onMounted(() => {
  api.getOrderType({type:props.type}).then(res => {
    if (res.data.status === 200) {
      orderList.value = res.data.data
    }
  })
})

</script>
<style lang="less" scoped>
.order-container {
  margin-top: 5px;
}
</style>
